#include "ZGF_EnPacket.h"

namespace ZGF
{

	ZGF_EnPacket::ZGF_EnPacket()
	{
		m_data.clear();
	}

	ZGF_EnPacket::ZGF_EnPacket(const ZGF_EnPacket& INinstance)
	{
		m_data = INinstance.m_data;
	}

	ZGF_EnPacket::~ZGF_EnPacket()
	{
		m_data.clear();
	}

	ZGF_EnPacket& ZGF_EnPacket::operator= (const ZGF_EnPacket& INinstance)
	{
		m_data = INinstance.m_data;
		return *this;
	}

	void ZGF_EnPacket::PushBool(bool INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushChar(char INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushUChar(unsigned char INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushShort(short INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushUShort(unsigned short INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushInt(int INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushUInt(unsigned int INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushLong(long INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushULong(unsigned long INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushInt64(__int64 INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushFloat(float INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushDouble(double INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushUInt64(unsigned __int64 INvalue)
	{
		PushData(&INvalue);
	}

	void ZGF_EnPacket::PushString(const string& INdata)
	{
		PushString(INdata.c_str(), INdata.size());
	}

	void ZGF_EnPacket::PushString(const char* INdata, UInt32 INdataSize)
	{
		PushData(INdata, INdataSize);
	}

	template <typename DataType>
	void ZGF_EnPacket::PushData(DataType* INdata, UInt32 INdataSize /* = sizeof */)
	{
		m_data.append((char*)INdata, INdataSize);
	}

}
